package utils

import (
	"context"

	"github.com/gogf/gf/v2/net/ghttp"
)

const requestKey = "sys_request"

func SetRequest(request *ghttp.Request) {
	request.SetCtxVar(requestKey, request)
}

func GetRequest(ctx context.Context) (request *ghttp.Request) {
	val := ctx.Value(requestKey)
	request = val.(*ghttp.Request)
	return
}
